//
//  FMAudioRecord.m
//  TestDemo
//
//  Created by fengxijun on 4/19/16.
//  Copyright © 2016 goappbox. All rights reserved.
//

#import "FMAudioRecord.h"
#import <AVFoundation/AVFoundation.h>

@interface FMAudioRecord ()
@property (nonatomic, strong) NSURL *url;
@end

@implementation FMAudioRecord

- (instancetype)initWithFile:(NSString *)filepath {
    return [self initWithUrl:[NSURL fileURLWithPath:filepath]];
}

- (instancetype) initWithUrl:(NSURL *)url {
    self = [super init];
    if (self) {
        self.url = url;
    }
    return self;
}

- (void)record {
    [[AVAudioSession sharedInstance] requestRecordPermission:^(BOOL granted) {
        if (!granted) {
            if (self.audioRecordStatus) {
                self.audioRecordStatus(FMAudioRecordNotAllowed);
            }
            return;
        }
        [self beginRecord];
    }];
}

- (void)beginRecord {
    
}

- (void)stop {
    
}

- (void)pause {
    
}

- (void)resume {
    
}

- (void)setUpRecordSessions {
    
}

@end
